package com.cxhc.system.domain.app;

import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import lombok.experimental.Accessors;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.cxhc.common.annotation.Excel;
import com.cxhc.common.core.domain.BaseEntity;

/**
 * 事项审批流程对象 approval_flow
 * 
 * @author Dhq
 * @date 2024-08-06
 */
@Data
@Accessors(chain = true)
public class ApprovalFlow
{

    /** ID */
    private Long id;

    /** 事项ID */
    private Long eventId;

    /** 审批人ID */
    private Long userId;

    /** 审批人名称 */
    private String userName;

    /** 审批人部门名称 */
    private String deptName;

    /** 审批意见 */
    private String content;

    /** 0 待审批 1 审批通过 2 不通过退回 */
    private Integer status;

    /** 0 审批结果1同意并完成，2同意并加签，3驳回 */
    private Integer resultStatus;

    /** 提交时间 */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm")
    private Date createAt;

    /** 审批时间 */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm")
    private Date approvalAt;


    public Map<String,String> getStatusMap() {
        if(Objects.isNull(status)){
            return new HashMap<>();
        }
        Map<String,String> map = new HashMap<>();
        if(status == 0){
            map.put("name","待审批");
            map.put("color","#F27900");
            map.put("bgColor","#FFF4D1");
        }else if(status == 1){
            map.put("name","审批中");
            map.put("color","#1677FF");
            map.put("bgColor","rgba(22,119,255,0.1)");
        }else if(status == 2){
            map.put("name","审批通过");
            map.put("color","#08A944");
            map.put("bgColor","rgba(8,169,68,0.1)");
        }else if(status == -1){
            map.put("name","驳回");
            map.put("color","#FF2121");
            map.put("bgColor","rgba(255,33,33,0.1)");
        }
        return map;
    }


}
